package org.xtense.data;

/**
 * Use Properties file to store DB information. This class is used to get information like
 * driver, url, username, password from Properties file.
 * 
 */

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import org.xtense.log.iLog;

public class DBConfigFromFile extends DBConfig {

	protected DBConfigFromFile() {
		String filePath = "db.properties";
		Properties property = new Properties();
		try {
			FileInputStream inputStream = new FileInputStream(filePath);
			property.load(inputStream);
			inputStream.close();
		} catch (FileNotFoundException e) {
			iLog.error(e);
		} catch (IOException e) {
			iLog.error(e);
		}

		this.driver = property.getProperty("driver");
		this.url = property.getProperty("url");
		this.username = property.getProperty("username");
		this.password = property.getProperty("password");
	}
}
